package Controllers

import (
	"github.com/gin-gonic/gin"
)

type commonController struct{}

func (that *commonController) SendSuccessResponse(r *gin.Context, data any, msg string) {
	if msg == "" {
		msg = "请求成功"
	}
	r.JSON(200, gin.H{
		"code": 200,
		"data": data,
		"msg":  msg,
	})
}

func (that *commonController) SendFailResponse(r *gin.Context, msg string) {
	if msg == "" {
		msg = "请求失败"
	}
	r.JSON(500, gin.H{
		"code": 500,
		"msg":  msg,
	})
}
